<?php
class News_Cat extends Base{
   var $table = 'news';
   var $id_field = 'new_id';
   var $name_field = 'new_title';
   var $page;
   var $page_size = 8;//Kích cỡ 1 trang hiển thị bao nhiêu kết quả
   var $result = array();
   public function __construct($page = 0){
      $this->page = $page;
      if($this->page == 0)
         $this->page = 1;
      $start_page = ($this->page - 1)*$this->page_size;
      $this->result = db_array('SELECT *
                            FROM '.$this->table.'
                            WHERE new_active = 1
                            ORDER BY new_id DESC
                            LIMIT '.$start_page.','.$this->page_size.'');
      if($this->result) {   
         $this->name = 'Tin tức';
         $this->description = 'Tin tức vải địa kỹ thuật - Daejung Việt Nam';
         $this->url = '/tin-tuc/';
      }
      parent::__construct();
   }
   function news_total() {
      $db_count = new db_count('SELECT count(*) as count FROM '.$this->table.' WHERE new_active = 1');
      return $db_count->total;
   }
}
?>